/**
 * 
 */
package bpel.types;

import java.util.HashMap;

/**
 * @author Maurice & Topia
 *
 */
public class BPELMessage extends BPELType {

	private String name;
	private HashMap<String, BPELPart> parts;

	public BPELMessage(String name) {
		super();
		this.name = name;
		parts = new HashMap<String, BPELPart>();
	}

	public void addPart(String name, BPELPart part) {
		parts.put(name, part);
	}
	
	public HashMap<String, BPELPart> getParts() {
		return parts;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public String toString() {
		String msgStr = "message" + name + " {\n";

		for (String part : parts.keySet()) {
			msgStr += parts.get(part).toString() + "\n";
		}

		msgStr += "}";

		return msgStr;
	}
	
	@Override
	public String getTypeNodeName() {
		return "message";
	}
}
